<%--
  Created by IntelliJ IDEA.
  User: W
  Date: 2025/9/18
  Time: 14:18
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%
    String name = "";
    String passwd = "";
    String rememberMe = "";
    Cookie[] cookies = request.getCookies();
    if (cookies != null && cookies.length > 0) {
        for(Cookie cookie : cookies){
            if("username".equals(cookie.getName())){
                name = cookie.getValue();
            }else{
                if("passwd".equals(cookie.getName())){
                    passwd = cookie.getValue();
                }else{
                    if("rememberMe".equals(cookie.getName())){
                        rememberMe = cookie.getValue();
                    }
                }
            }
        }
    }
%>

<html>
<head>
    <title>登录</title>
</head>
<body>
<form action="process.jsp" method="post">
    <div>
        用户名:<input type="text" name="username" id="username" value="<%=name%>">
    </div>
    <div>
        密码:<input type="password" name="passwd" id="passwd" value="<%=passwd%>">
    </div>
    <div>
        记住我<input type="checkbox" name="rememberMe" <%= "on".equals(rememberMe) ? "checked" : "" %>>
        <input type="submit" value="登录">
    </div>
</form>
</body>
</html>
